const rateLimit = require('express-rate-limit');
const config = require('../config/config');

const apiLimiter = rateLimit({
  windowMs: config.RATE_LIMIT_WINDOW_MS,
  max: config.RATE_LIMIT_MAX,
  message: {
    code: 429,
    message: '请求太多，请稍后重试。'
  },
  standardHeaders: true,
  legacyHeaders: false,
});


module.exports = {
  apiLimiter
};